import { Global } from "../../info/Global";
import Player from "../../player/Player";
import DestructibleFacility from "../DestructibleFacility";

const { ccclass, property } = cc._decorator;

/**
 * 光伏板
 */
@ccclass
export default class PhotovoltaicPanel extends DestructibleFacility {

    @property(cc.Animation)
    anima: cc.Animation = null;

    diamond: number;
    oil: number;

    public get level(): number {
        return this._level;
    }

    public set level(v: number) {
        this._level = v;
        this.diamond = this.facilityInfo.每等级提供能量[this._level].diamond;
        this.oil = this.facilityInfo.每等级提供能量[this._level].oil;
    }

    init(player: Player): void {
        super.init(player);
        this.anima.play();
        this.level = 1;
    }

    addResource() {
        this.player.addDiamondAndOil(this.diamond, this.oil, this.node.position);
    }

}
